}
function _getEndOfDay(date) {
- let ret = new Date(date.getTime());
- ret.setHours(23);
- ret.setMinutes(59);
- ret.setSeconds(59);
- ret.setMilliseconds(999);
+ const ret = _getBeginningOfDay(date);
+ ret.setDate(ret.getDate() + 1);
return ret;
}
}
setDate(date) {
- const day = [date.getFullYear(), date.getMonth(), date.getDate()];
- this._startDate = new Date(...day);
- this._endDate = new Date(...day, 23, 59, 59, 999);
+ this._startDate =
+ new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ this._endDate =
+ new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
this._updateTitle();
this._reloadEvents();
const timeSpanDay = GLib.TIME_SPAN_DAY / 1000;
const now = new Date();
- if (this._startDate <= now && now <= this._endDate)
+ if (this._startDate <= now && now < this._endDate)
this._title.text = _('Today');
- else if (this._endDate < now && now - this._endDate < timeSpanDay)
+ else if (this._endDate <= now && now - this._endDate < timeSpanDay)
this._title.text = _('Yesterday');
- else if (this._startDate > now && this._startDate - now < timeSpanDay)
+ else if (this._startDate > now && this._startDate - now <= timeSpanDay)
this._title.text = _('Tomorrow');
else if (this._startDate.getFullYear() === now.getFullYear())
this._title.text = this._startDate.toLocaleFormat(sameYearFormat);